package com.example.demo.exception;

public class UserException extends RuntimeException {
    Integer code;
    String msg = "";

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
    public UserException(int code , String msg) {
        super("XXX");
        this.code = code;
        this.msg = msg;
    }
    public UserException(int code) {
        super("XXX");
        this.code = code;
        switch (code) {
            case 200:
                this.msg = "成功";
                break;
            case 401:
                this.msg = "18岁有问题";
                break;
        }
    }
}
